﻿<!DOCTYPE HTML>
<html lang="zh">
<head>
<title>获取音频设备静音状态 - 语法 &amp; 使用 | AutoHotkey v2</title>
<meta name="description" content="The 获取音频设备静音状态 function retrieves a mute setting of a sound device." />
<meta name="ahk:equiv-v1" content="commands/SoundGet.htm" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
<script type="text/javascript">$(function(){0<=window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")&&CaoNiMaDeUc()})</script>
</head>
<body>

<h1>获取音频设备静音状态</h1>

<p>检索声音设备的静音设置.</p>

<pre class="Syntax">Setting := <span class="func">获取音频设备静音状态</span>(<span class="optional">Component, Device</span>)</pre>
<h2 id="Parameters">参数</h2>
<dl>

  <dt>Component</dt>
  <dd>
    <p>类型: <a href="../Concepts.htm#strings">字符串</a>或<a href="../Concepts.htm#numbers">整数</a></p>
    <p>组件的显示名称和/或索引. 例如, <code>1</code>, <code>"Line in"</code> 或 <code>"Line in:2"</code>.</p>
    <p>如果省略或为空, 则检索主静音设置.</p>
    <p>有关详情, 请参阅 <a href="Sound.htm#component">Component (Sound 函数)</a>.</p>
  </dd>

  <dt>Device</dt>
  <dd>
    <p>类型: <a href="../Concepts.htm#strings">字符串</a>或<a href="../Concepts.htm#numbers">整数</a></p>
    <p>设备的显示名称和/或索引. 例如, <code>1</code>, <code>"Speakers"</code>, <code>"Speakers:2"</code> 或 <code>"Speakers (Example HD Audio)"</code>.</p>
    <p>如果省略该参数, 则它默认为系统的默认回放设备(不一定是设备 1).</p>
    <p>有关详情, 请参阅 <a href="Sound.htm#device">Device (Sound 函数)</a>.</p>
  </dd>

</dl>

<h2 id="Return_Value">返回值</h2>
<p>类型: <a href="../Concepts.htm#boolean">整数(布尔值)</a>或<a href="../Concepts.htm#nothing">字符串(空值)</a></p>
<p>函数返回 0(未静音) 或 1(静音).</p>

<h2 id="Error_Handling">错误处理</h2>
<p>失败时抛出异常. 异常的 <em>Message</em> 属性可以包含以下内容之一:</p>
<ul>
    <li>Device not found(无法找到设备)</li>
    <li>Component not found(无法找到组件)</li>
    <li>Component doesn't support this control 类型(组件不支持此控件类型)</li>
    <li><em>Subject to change:</em> An internal function call failed.(<em>随时会变化:</em> 内部函数调用失败.)</li>
</ul>

<h2 id="Remarks">备注</h2>
<p>要发现系统上安装的声音设备的功能 -- 比如名称和可用的组件 -- 请运行这个<a href="Sound.htm#ExSoundcard">声卡分析脚本</a>.</p>

<h2 id="Related">相关</h2>
<p><a href="Sound.htm">Sound 函数</a></p>

<h2 id="Examples">示例</h2>
<div class="ex" id="ExBasic">
<p><a href="#ExBasic">#1</a></p>
<pre>master_mute := 获取音频设备静音状态()
如果 master_mute
    信息框 "The default playback device is muted."
否则
    信息框 "The default playback device is not muted."

如果 获取音频设备静音状态("Line In") = 0
    信息框 "Line In pass-through is not muted."

如果 获取音频设备静音状态( , "Microphone") = 0
    信息框 "The microphone (recording) is not muted."</pre>
</div>

</body>
</html>